<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>photo.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
  </script>

  <script src="static/js/doc.js">
  </script>

  <meta charset="utf8">
</head>

<body onload="prettyPrint()">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
       <span class="fn">photo.js</span>
</div>

<div class="g-section g-tpl-75-25">
  <div class="g-unit g-first" id="description">
    provides a reusable photo UI component that renders photos that
 contains metadata (such as captions, description, thumbnail/high resolution
 versions, etc).

 goog.ui.media.Photo is actually a {@link goog.ui.ControlRenderer},
 a stateless class - that could/should be used as a Singleton with the static
 method {@code goog.ui.media.Photo.getInstance} -, that knows how to render
 Photos. It is designed to be used with a {@link goog.ui.Control}, which will
 actually control the media renderer and provide the {@link goog.ui.Component}
 base. This design guarantees that all different types of medias will behave
 alike but will look different.

 goog.ui.media.Photo expects {@code goog.ui.media.MediaModel} on
 {@code goog.ui.Control.getModel} as data models.

 Example of usage:

 <pre class="lang-js">
 var photo = goog.ui.media.Photo.newControl(
 new goog.ui.media.MediaModel(&#39;<a href="http://hostname/file.jpg&#39;)">http://hostname/file.jpg&#39;)</a>);
 photo.render(goog.dom.$(&#39;parent&#39;));
 </pre>

 Photo medias currently support the following states:

 <ul>
 <li> {@link goog.ui.Component.State.HOVER}: mouse cursor is over the photo.
 <li> {@link goog.ui.Component.State.SELECTED}: photo is being displayed.
 </li></li></ul>

 Which can be accessed by

 <pre class="lang-js">
 photo.setHighlighted(true);
 photo.setSelected(true);
 </pre>
  </div>
  

        <div class="g-unit" id="useful-links">
          <div class="title">Useful links</div>
          <ol>
            <li><a href="closure_goog_ui_media_photo.js.source.html"><span class='source-code-link'>Source Code</span></a></li>
          </ol>
        </div>
</div>

<h2 class="g-first">File Location</h2>
  <div class="g-section g-tpl-20-80">
    <div class="g-unit g-first">
      <div class="g-c-cell code-label">ui/media/photo.js</div>
    </div>
  </div>
<hr/>


  <h2>Classes</h2>
 <div class="fn-constructor">
        <a href="class_goog_ui_media_Photo.html">
          goog.ui.media.Photo</a><br/>
        <div class="class-details">Subclasses a goog.ui.media.MediaRenderer to provide a Photo specific media
renderer. Provides a base class for any other renderer that wants to display
photos.

This class is meant to be used as a singleton static stateless class, that
takes {@code goog.ui.media.Media} instances and renders it.

This design is patterned after
<a href="http://go/closure_control_subclassing">http://go/closure_control_subclassing</a></div>
 </div>
      
<br/>

  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>


  <h2>Global Functions</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.ui.media.Photo.newControl"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.ui.media.Photo.</span><span class="entryName">newControl<span class="args">(<span class="arg">dataModel</span>)</span>
        </span>
        &#8658; <div class="fullType"><span class="type"><a href="class_goog_ui_media_Media.html">goog.ui.media.Media</a></span></div>
      </div>


     <div class="entryOverview">
       A static convenient method to construct a goog.ui.media.Media control out of
a photo {@code goog.ui.media.MediaModel}. It sets it as the data model
goog.ui.media.Photo renderer uses, sets the states supported by the renderer,
and returns a Control that binds everything together. This is what you
should be using for constructing Photos, except if you need finer control
over the configuration.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">dataModel</span>
        : <div class="fullType"><span class="type"><a href="class_goog_ui_media_MediaModel.html">goog.ui.media.MediaModel</a></span></div>
        <div class="entryOverview">The photo data model.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType"><span class="type"><a href="class_goog_ui_media_Media.html">goog.ui.media.Media</a></span></div>&nbsp;
            A goog.ui.Control subclass with the photo renderer.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_ui_media_photo.js.source.html#line103">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>



  <h2>Global Properties</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>





  <a name="goog.ui.media.Photo.CSS_CLASS"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.ui.media.Photo.</span><span class="entryName">CSS_CLASS</span>
        : <div class="fullType"><span class="type"><a href="http://www.google.com/url?sa=D&q=https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span></div>
     </div>


     <div class="entryOverview">
       Default CSS class to be applied to the root element of components rendered
by this renderer.
     </div>

  </td>


  <td class="view-code">
     <a href="closure_goog_ui_media_photo.js.source.html#line88">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>



      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Directory media</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">File Reference</h2>
            <div id="sideFileIndex" rootPath="closure/goog" current="ui/media/photo.js"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
